﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using TyMES.Model;
using TyMES.Model.BaseInformation;

namespace TyMES.Model.BaseInformation
{
    /// <summary>
    /// 车间管理
    /// </summary>
	[Table("T_Workshops")]
    [SoftKey(nameof(Workshop.WorkshopCode))]
    [Display(Name = "_Model.Workshop")]
    public class Workshop : BasePoco,IPersistPoco
    {
        [Display(Name = "_Model._Workshop._WorkshopCode")]
        [StringLength(100, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("车间编码")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [CanNotEdit]
        public string WorkshopCode { get; set; }
        [Display(Name = "_Model._Workshop._WorkshopName")]
        [StringLength(100, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("车间名称")]
        public string WorkshopName { get; set; }
        [Display(Name = "_Model._Workshop._FactoryCode")]
        [Comment("工厂编码")]
        [NotMapped]
        public Factory FactoryCode { get; set; }
        [Display(Name = "_Model._Workshop._FactoryCode")]
        [Required(ErrorMessage = "Validate.{0}required")]
        [Comment("工厂编码")]
        public string FactoryCodeId { get; set; }
        [Display(Name = "_Model._Workshop._ResponsibleId")]
        [StringLength(100, ErrorMessage = "Validate.{0}stringmax{1}")]
        [Comment("负责人")]
        public string ResponsibleId { get; set; }
        [Display(Name = "_Model._Workshop._Status")]
        [Comment("车间状态")]
        public BaseStatusEnum? Status { get; set; }
        [Display(Name = "_Model._Line._WorkshopCode")]
        [InverseProperty("WorkshopCode")]
        [NotMapped]
        [SoftFK(nameof(TyMES.Model.BaseInformation.Line.WorkshopCodeId))]
        public List<Line> Line_WorkshopCode { get; set; }
        [Display(Name = "_Model._Workshop._IsValid")]
        [Comment("是否有效")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool IsValid { get; set; } = true;

	}

}
